<template>
  <div class="app-container">
      <levelbar></levelbar>
      <div class="content">
          <div class="top-title" v-if="!this.$route.params.id">添加广告</div>
          <div class="top-title" v-else>编辑广告</div>
        <span class="title">广告类型</span>
        <el-form :model="form" ref="form" label-width="82px" class="form">
          <el-row :gutter="41">
            <el-col :span="10">
              <el-form-item label="广告类型">
                <div v-if="advertId">{{form.value== '0'?'积分商城顶部广告位': form.value== '1'?'e学云教育平台首页广告位': form.value== '2'? 'APP全屏广告位':form.value== '5'?'空间首页顶部广告位':''}}</div>
                <el-select v-else v-model="form.value" placeholder="请选择" style="width:100%">
                  <el-option v-for="item in form.options" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <!-- 积分商城广告位 -->
        <integralShop :advertId='advertId' :advType='form.value' v-if="form.value == '0'"></integralShop>
        <!-- e学云教育平台首页广告位 -->
        <eXuePlatform :advertId='advertId' :advType='form.value' v-else-if="form.value == '1'"></eXuePlatform>
        <!-- app全屏广告位 -->
        <advApp :advertId='advertId' :advType='form.value' v-else-if="form.value == '2'"></advApp>
        <!-- 空间顶部广告位 -->
        <spaceAdv :advertId='advertId' :advType='form.value' v-else></spaceAdv>
      </div>
  </div>
</template>
<script>
import Levelbar from '../../../layout/Levelbar';
import advApp from './advApp';
import spaceAdv from './spaceAdv';
import integralShop from './integralShop';
import eXuePlatform from './eXuePlatform';
export default {
    name: 'parcelMangement',
    components: { Levelbar, advApp, spaceAdv, integralShop, eXuePlatform },
    created() {
      // 传递过来查看那个
        // console.log(this.$route.params.start)
        this.getState()
    },
    data() {
        return {
            form: {
                options: [
                    {
                        label: '积分商城顶部广告位',
                        value: '0'
                    },
                    {
                        label: 'e学云教育平台首页广告位',
                        value: '1'
                    },
                    {
                        label: 'APP全屏广告位',
                        value: '2'
                    },
                    {
                        label: '空间首页顶部广告位',
                        value: '5'
                    }
                ],
                value: '0'
            },
            // getCook: false,
            advertId: this.$route.params.id
        };
    },
    methods: {
        getState() {
            if (this.$route.params.state) {
                // this.getCook = true;
                this.form.value = this.$route.params.state;
            } else {
                this.form.value = '0';
            }
        }
    }
};
</script>
<style lang="scss" scoped>
.top-title{
    text-align: center;
    font-size: 18px;
    color: #333;
    height: 72px;
    line-height: 72px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}
.app-container {
  position: relative;
  padding: 20px 20px 10px;
  overflow: hidden;
  .content {
    position: relative;
    padding: 8px 50px 10px;
    background: #fff;
    box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.1);
    -webkit-box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.1);
    .title {
      position: relative;
      font-size: 14px;
      color: rgb(106, 85, 72);
      padding-left: 14px;
      margin: 30px 0;
      display: block;
      &::after {
        position: absolute;
        content: "";
        width: 4px;
        height: 14px;
        background: #ff5e2c;
        left: 0;
        top: 4px;
      }
    }
  }
}
</style>
